//
//  TrainTrainsHalf.m
//  MINFOBBS
//
//  Created by juvid on 13-11-28.
//  Copyright (c) 2013年 minfo. All rights reserved.
//

#import "TrainTrainsHalf.h"
#import "TrainTrains.h"

#import "MainSearchViewController.h"
#import "TrainStation.h"

@interface TrainTrainsHalf ()

@end

@implementation TrainTrainsHalf

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    NSArray *arr=[[self.arrReturn objectForKey:@"Properties"] objectForKey:@"Property"];
    self.labTimes.text=[[arr objectAtIndex:0] objectForKey:@"text"];
    self.imgTrainClass.image=[UIImage imageNamed:[[arr objectAtIndex:1] objectForKey:@"text"]];
    self.labTrainClass.text=[[arr objectAtIndex:1] objectForKey:@"text"];
    self.labFirst.text=[[arr objectAtIndex:2] objectForKey:@"text"];
    self.labEnd.text=[[arr objectAtIndex:4] objectForKey:@"text"];
    self.labTotalTime.text=[NSString stringWithFormat:@"运行时间：%@",[[arr objectAtIndex:7] objectForKey:@"text"]];
    self.labDistance.text=[NSString stringWithFormat:@"距离：%@",[[arr objectAtIndex:8] objectForKey:@"text"]];
    arr=Nil;
    
    // Do any additional setup after loading the view from its nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (MainSearchViewController *)menuContainerViewController {
    return (MainSearchViewController *)self.parentViewController;
}
- (IBAction)PressTick:(id)sender {
    TrainTrains *jokecon=[[TrainTrains alloc]init];
    jokecon.arrReturn=self.arrReturn;
    [ [self menuContainerViewController].navigationController  pushViewController:jokecon animated:YES];
}

- (IBAction)PressStation:(id)sender {
    TrainStation *jokecon=[[TrainStation alloc]init];
    
    NSString *str=[[[[self.arrReturn objectForKey:@"Links"] objectForKey:@"Link"] objectAtIndex:0] objectForKey:@"href"];

    //        NSLog(@"%@",str);
    NSRange range = [str rangeOfString:@"query="];
    jokecon.strKey=[str substringFromIndex:range.location +range.length];
    jokecon.isQuery=YES;
    jokecon.strClass=self.labTrainClass.text;
    str=nil;
    [ [self menuContainerViewController].navigationController  pushViewController:jokecon animated:YES];
}
@end
